package com.company.cloud.tenant.modules.api.fallback;


import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.tenant.modules.api.request.*;
import com.company.cloud.tenant.modules.api.response.TenantFull;
import com.company.cloud.tenant.modules.api.response.TenantFullPage;
import com.company.cloud.tenant.modules.api.response.TenantSimple;
import com.company.cloud.tenant.modules.api.service.TenantRemoteService;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.Set;

@Log4j2
@Component
public class TenantRemoteServiceFallbackFactory implements FallbackFactory<TenantRemoteService> {

    @Override
    public TenantRemoteService create(Throwable cause) {

        return new TenantRemoteService() {
            @Override
            public BaseClientResult<TenantSimple> getTenantSimple(String tenantCode) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<Map<String, TenantSimple>> getTenantMapSimple(Set<String> tenantCodes) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> getTenantFull(String tenantCode) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<Map<String, TenantFull>> getTenantMapFull(Set<String> tenantCodes) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFullPage> queryTenantFull(TenantQueryRequest request) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> addTenant(TenantAddRequest request) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> addTenant2User(Tenant2UserAddRequest request) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> updateTenant(TenantUpdateRequest request) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> delTenant(TenantDelRequest request) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> checkTenant(TenantCheckRequest request) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> frozenTenant(TenantFrozenRequest request) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<TenantFull> unfreezeTenant(TenantUnFreezeRequest request) {
                return null;
            }
        };
    }
}
